<template>
  <div class="artical">
    <!-- 工具栏 -->
    <div class="toolbar">
      <div class="left">
        <el-button type="primary" icon="el-icon-plus">添加</el-button>
      </div>
    </div>
    <!-- 表格区域 -->
    <div class="tablebox">
      <el-table border stripe :data="tableData">
        <el-table-column label="编号" prop="articalId">
          <template slot-scope="scope">{{(currentPage-1)*pageSize + scope.$index+1}}</template>
        </el-table-column>
        <el-table-column label="文章名称" prop="articalName"></el-table-column>
        <el-table-column label="作者" prop="userName"></el-table-column>
        <el-table-column label="分类名称" prop="className"></el-table-column>
        <el-table-column label="状态" prop="status">
          <template slot-scope="scope">
            <el-tag size="medium" v-if="scope.row.status">正常</el-tag>
            <el-tag size="medium" v-else type="danger">禁用</el-tag>
          </template>
        </el-table-column>

        <el-table-column label="创建时间" prop="createTime">
          <template slot-scope="scope">{{ scope.row.createTime | formatTime }}</template>
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button size="mini">编辑</el-button>
            <el-button size="mini" type="danger">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- 分页区域-->
    <div class="page">
      <el-pagination
        hide-on-single-page
        background
        :current-page="currentPage"
        :page-sizes="[5,6,7,8]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      loading: false,
      searchTxt: "",
      currentPage: 1, //当前页
      pageSize: 5, //每页条数
      total: 0, //总条数
      tableData: []
    };
  },
  created() {},
  methods: {}
};
</script>

<style lang="less" scoped>
.artical {
  width: 100%;
  min-height: calc(100vh - 98px);
  background: #fff;
  padding: 15px;
  .toolbar {
    margin-bottom: 20px;
    overflow: hidden;
    .left {
      float: left;
    }
    .right {
      float: right;
    }
  }
  .page {
    text-align: center;
    margin-top: 20px;
  }
}
</style>